using UnityEngine;

public class PlayerWallJumpState : PlayerAbilityState
{
    protected int _wallJumpDirection;

    public PlayerWallJumpState(Player player, PlayerSM stateMachine, PlayerData playerData, string animBoolName,
        Core core) : base(player, stateMachine, playerData, animBoolName, core)
    {
    }

    public override void Enter()
    {
        base.Enter();
        _player.JumpState.ResetJumpCount();
        _core.Movement.SetVelocity(_playerData._wallJumpVelocity, _playerData._wallJumpAngle, _wallJumpDirection);
        _core.Movement.CheckIfShouldFilp(_wallJumpDirection);
        _player.JumpState.DecreaseCountofJump();
    }

    public override void LogicUpdate()
    {
        base.LogicUpdate();
        //TODO:���ö���

        if (Time.time > _startTime + _playerData._wallJumpTime) _isAbilityDone = true;
    }

    public void DetermineWallJumpDirection(bool isTouchingWall)
    {
        if (isTouchingWall)
            _wallJumpDirection = -_core.Movement.FacingDirection;
        else
            _wallJumpDirection = _core.Movement.FacingDirection;
    }
}